<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>SQL: User mail forwarding</title>
        <link rel="stylesheet" type="text/css" href="./css/markdown.css" />
    </head>
    <body>

    <div id="navigation">
    <a href="https://www.iredmail.org" target="_blank">
        <img alt="iRedMail web site"
             src="./images/logo-iredmail.png"
             style="vertical-align: middle; height: 30px;"
             />&nbsp;
        <span>iRedMail</span>
    </a>
    &nbsp;&nbsp;//&nbsp;&nbsp;<a href="./index.html">Document Index</a></div><h1 id="sql-user-mail-forwarding">SQL: User mail forwarding</h1>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>Check out the lightweight on-premises email archiving software developed by iRedMail team: <a href="https://spiderd.io/">Spider Email Archiver</a>.</p>
</div>
<div class="toc">
<ul>
<li><a href="#sql-user-mail-forwarding">SQL: User mail forwarding</a><ul>
<li><a href="#set-mail-forwarding-with-iredadmin-pro">Set mail forwarding with iRedAdmin-Pro</a></li>
<li><a href="#set-mail-forwarding-with-sql-command-line">Set mail forwarding with SQL command line</a></li>
<li><a href="#related-tutorial">Related tutorial</a></li>
</ul>
</li>
</ul>
</div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<ul>
<li>This document is applicable to iRedMail-0.9.6 and earlier releases.</li>
<li>Here's <a href="./sql.user.mail.forwarding.html">doc for iRedMail-0.9.7 and later releases</a>.</li>
</ul>
</div>
<h2 id="set-mail-forwarding-with-iredadmin-pro">Set mail forwarding with iRedAdmin-Pro</h2>
<p>With iRedAdmin-Pro, you can manage mail forwarding addresses in user
profile page, under tab <code>Forwarding</code>.</p>
<p>Screenshot:</p>
<p><img alt="" src="./images/iredadmin/user_profile_mail_forwarding.png" width="1000px" /></p>
<h2 id="set-mail-forwarding-with-sql-command-line">Set mail forwarding with SQL command line</h2>
<p>Let's say you have an existing mail user <code>user@domain.com</code>, and you want to
forward all received emails to another address <code>forward@example.com</code>,
to achieve this, you can login to SQL server and update <code>vmail</code> database like
below:</p>
<pre><code>sql&gt; USE vmail;
sql&gt; UPDATE alias SET goto='forward@example.com' WHERE address='user@domain.com';
</code></pre>
<p>If you want to forward email to multiple destinations, please separate
addresses with comma like below:</p>
<pre><code>sql&gt; UPDATE alias SET goto='forward_1@example.com,forward_2@example.com,forward_3@example.com' WHERE address='user@domain.com';
</code></pre>
<p>To save a copy of forwarded email in mailbox, please add your own email address
as a forwarding destination like below:</p>
<pre><code>sql&gt; UPDATE alias SET goto='user@domain.com,forward_1@example.com' WHERE address='user@domain.com';
</code></pre>
<h2 id="related-tutorial">Related tutorial</h2>
<ul>
<li><a href="./ldap.user.mail.forwarding.html">LDAP: user mail forwarding</a></li>
</ul><div class="footer">
    <p style="text-align: center; color: grey;">All documents are available in <a href="https://github.com/iredmail/docs/">GitHub repository</a>, and published under <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">Creative Commons</a> license. You can <a href="https://github.com/iredmail/docs/archive/master.zip">download the latest version</a> for offline reading. If you found something wrong, please do <a href="https://www.iredmail.org/contact.html">contact us</a> to fix it.</p>
</div></body></html>